test = function(array) {
    const app = array
    const upper = []
    const low = []
    const other = []

    for (let index = 0; index < array.length; index++) {
        const element = array[index];
        const code = element.charCodeAt(0)

        if (code >= 65 && code <= 90) {  // 大写字母范围修正为65-90
            upper.push(element)
        } else if (code >= 97 && code <= 122) {
            low.push(element)
        } else {
            other.push(element)
        }
    }
    
    let flag1 = upper.length
    let flag2 = low.length
    console.log("大写字母数量:" + flag1)
    console.log("小写字母数量:" + flag2)
    
    // 正确遍历数组
    console.log("大写字母:")
    for (let index = 0; index < upper.length; index++) {
        const element = upper[index]
        console.log(element)
    }
    
    console.log("小写字母:")
    for (let index = 0; index < low.length; index++) {
        const element = low[index]
        console.log(element)
    }
    console.log("翻转字母字母:")
    let flag3 = upper.concat(low).reverse()
    console.log(flag3)
}

test("abcEFG")
